package com.xuxin.nantai.presenter;

import com.xuxin.nantai.bean.BaseBean;
import com.xuxin.nantai.bean.DefaultGroupBean;
import com.xuxin.nantai.bean.FlowingCodeBean;
import com.xuxin.nantai.bean.GroupBean;
import com.xuxin.nantai.bean.InspectorBean;
import com.xuxin.nantai.contract.CompleteUpdateContract;
import com.xuxin.nantai.model.CompleteUpdateModel;

/**
 * Created by xu_xin
 * Created on 2020.06.08 0008
 */
public class CompleteUpdatePresenter implements CompleteUpdateContract.Presenter {
    private CompleteUpdateModel model;
    private CompleteUpdateContract.View view;

    public CompleteUpdatePresenter(CompleteUpdateContract.View view) {
        model = new CompleteUpdateModel();
        this.view = view;
    }

    @Override
    public void getInspector(String loginName, String TeamType) {
        if (null != model) {
            model.getInspector(this, loginName, TeamType);
        }
    }

    @Override
    public void getFlowingCode(String FlowingCode) {
        if (null != model) {
            model.getFlowingCode(this, FlowingCode);
        }
    }

    @Override
    public void getGroups() {
        if (null != model) {
            model.getGroups(this);
        }
    }

    @Override
    public void update(String LoginName,
                       String UserName,
                       String Guid,
                       String ID,
                       String cInvCode,
                       String cInvName,
                       String PackQty,
                       String ComNum,
                       String CheckNum,
                       String InspectorCode,
                       String InspectorName,
                       String InspectTime,
                       String FacArea,
                       String TeamType,
                       int IsReCheck,
                       String FlowingCode,
                       String GroupName,
                       String GroupCode) {
        if (null != model) {
            model.update(this,
                    LoginName,
                    UserName,
                    Guid,
                    ID,
                    cInvCode,
                    cInvName,
                    PackQty,
                    ComNum,
                    CheckNum,
                    InspectorCode,
                    InspectorName,
                    InspectTime,
                    FacArea,
                    TeamType,
                    IsReCheck,
                    FlowingCode,
                    GroupName,
                    GroupCode);
        }
    }

    @Override
    public void getDefaultGroup(String LoginName) {
        if (null != model) {
            model.getDefaultGroup(this,LoginName);
        }
    }

    @Override
    public void onSuccess(InspectorBean inspectorBean) {
        if (null != view) {
            view.onSuccess(inspectorBean);
        }
    }

    @Override
    public void onSuccess(FlowingCodeBean flowingCodeBean) {
        if (null != view) {
            view.onSuccess(flowingCodeBean);
        }
    }

    @Override
    public void onSuccess(GroupBean groupBean) {
        if (null != view) {
            view.onSuccess(groupBean);
        }
    }

    @Override
    public void onSuccess(DefaultGroupBean defaultGroupBean) {
        if (null != view) {
            view.onSuccess(defaultGroupBean);
        }
    }

    @Override
    public void onSuccess(BaseBean baseBean) {
        if (null != view) {
            view.onSuccess(baseBean);
        }
    }

    /**
     * 以下内容复用
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}
